< previous page page_172 next page >

Page 172
0172-01.jpg
Figure 5.22.
Adding the CompanyMaster command buttons.
First, add the following line of code in the general declaration section of the form.
Dim nAddRec as Integer
The following code sections should be placed behind each button. You placed identical code behind other examples earlier this week. Begin with Listing 5.48, which shows the code to enter behind the cmdAdd command button.
Type.gifListing 5.48. Adding data records.
Private Sub cmdAdd_Click()
    '
    Data1.Recordset.AddNew ' add a new record to table
    nAddRec = True
    '
End Sub
Now add the code in Listing 5.49 to the cmdExit button. This code unloads the form when the Exit button is selected.
Type.gifListing 5.49. Unloading the CompanyMaster form.
Sub cmdExit_Click ()
  Unload Me ' close myself (better than END)
End Sub

 
< previous page page_172 next page >

If you like this book, buy it!